package com.rocketmq.c.listener;


import com.alibaba.fastjson.JSON;
import com.rocketmq.c.domain.MsgModel;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;


@Component
@RocketMQMessageListener(topic = "bootOrderlyTopic",consumerGroup = "order-consume-group",consumeMode = ConsumeMode.ORDERLY)
public class OrderlyBootMsgListener implements RocketMQListener<MessageExt> {

    @Override
    public void onMessage(MessageExt msgExt) {
        MsgModel msgModel = JSON.parseObject(new String(msgExt.getBody()), MsgModel.class);
        System.out.println("开始消费。OrderlyBootMsgListener。");
        System.out.println(msgModel);
    }
}
